/ Assembly List / LJCNetCommon / NetCommon / MemStreamToBytes

Namespace - LJCNetCommon


Parameters
stream - The stream object.

Returns

The byte array.

Syntax

C#
public static Byte[] MemStreamToBytes(Stream stream)

Copies a memory stream to a byte array. (E)

Example

C#
using System.IO;
using LJCNetCommon;
        
// Copies a memory stream to a byte array.
private static void MemStreamToBytes()
{
  // Setup
  byte[] textBytes;
  using (Stream stream = NetCommon.StringToMemStream("Text"))
  {
    // Copies a memory stream to a byte array.
    textBytes = NetCommon.MemStreamToBytes(stream);
  }
    
  // Check the text.
  string text = NetCommon.BytesToText(textBytes);
}

Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.